package com.java8.ch06;

// Now,volume() returns the volume of a box
public class BoxDemo4 {

	public static void main(String[] args) {
		BoxFour mybox1 = new BoxFour();
		double vol;
		// assign values to mybox1's instance variable
		mybox1.width = 3;
		mybox1.height = 6;
		mybox1.depth = 9;

		// display volume of mybox1
		System.out.println("Volume is " + mybox1.volume());

		BoxFour mybox2 = new BoxFour();
		// assign values to mybox2's instance variable
		mybox2.width = 10;
		mybox2.height = 20;
		mybox2.depth = 15;

		// display volume of mybox2
		System.out.println("Volume is " + mybox2.volume());
	}
}

class BoxFour {

	double width;
	double height;
	double depth;

	// display volume of a box
	double volume() {
		return width * height * depth;
	}
}
